﻿using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;
using System.Data;
using log4net;
using log4net.Config;
using mobiledata;
using mobilesecurity;
using System.Net.Mail;
using System.Net;
namespace mobileshop
{
    class Program
    {

        static void sendMailTest()
        {
            MailMessage mail = new MailMessage();
            SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

            mail.From = new MailAddress("nemanja.kojic@etf.rs", "Nemanja Kojic");
            mail.To.Add("nemanja.kojic@etf.rs");
            mail.Subject = "Test Mail";
            mail.Body = "This is for testing SMTP mail from GMAIL";

            // SmtpServer.Port = 587;
            SmtpServer.Credentials = new System.Net.NetworkCredential("yourusername", "password");
            SmtpServer.EnableSsl = true;

            SmtpServer.Send(mail);
        }

        static void Main(string[] args)
        {
            // Configure log4net from app.config file.
            XmlConfigurator.Configure();

            // Initialize data access API.
            AutomobilDataManager.init(Properties.Settings.Default.nemanjaConnectionString, DatabaseKind.MySql);

            // Call API functions.
            // AutomobilDataManager.instance.createUser("Nemanja", "Kojic", "nemanja.kojic@etf.rs", "si3iep");

            //string result = SecurityUtils.ComputeHash("tref");

            //Console.WriteLine("result:" + result);
            //Console.WriteLine("result size:" + result.Length);

            //bool ok = SecurityUtils.VerifyHash("tref", result);
            //Console.WriteLine(ok);
            User u = AutomobilDataManager.instance.getUser("nemanja.kojic@etf.rs", "si3iep");
            ServiceReference1.WebServiceSoapClient cl = new ServiceReference1.WebServiceSoapClient() ;
            ServiceReference1.User u1 = cl.HelloWorld();
            
            Console.WriteLine(u1.Surname);
            sendMailTest();
        }
    }
}
